<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport"
        content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
<script>
/*
流程图参看 ./作用域与闭包.png

closure	英[ˈkləʊʒə(r)] 美[ˈkloʊʒər]
n.	(永久的) 停业，关闭; 倒闭; (路或桥的) 暂时封闭; (因困境结束或事情得到妥善处理等的) 宽慰; 如释重负;
vt.	使结束; 使终止; 使停止辩论;
*/
  debugger;

  function a(){
    console.dir(b);
    var a1 = 'a1';
    console.dir(b);
    var a2 = 'a2';
    console.dir(b);
    function b(){
      console.log(a1);
    }
    return b
  }

  var x = a();
  console.dir(x)
  x();
</script>
</body>
</html>
